import request from "@/utils/request";
import { getParamsSuffix } from "@/utils/paramsUtils";


/**
 * 分页
 * @param params
 * @returns {Promise<any>}
 */
export async function listPagePerson(params) {
    return request('/api/cdcerserver/v1/cerpersoninfo/listPagePerson', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}

/**
 * 导入
 * @param params
 * @returns {Promise<any>}
 */
export async function uploadFile4CerDataInit() {
    return request('/api/cdcerserver/v1/cerpersoninfo/uploadFile4CerDataInit', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}

/**
 * 民族
 * @param query
 * @returns {Promise<any>}
 */
export async function nationlist(query) {
    const params = getParamsSuffix(query);
    return request(`/api/cdcerserver/v1/cerpersoninfo/nationlist?${params}`);
}

/**
 * 添加
 * @param params
 * @returns {Promise<any>}
 */
export async function addPersonInfo(params) {
    return request('/api/cdcerserver/v1/cerpersoninfo/addPersonInfo', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}


/**
 * 修改
 * @param params
 * @returns {Promise<any>}
 */
export async function editPersonInfo(params) {
    return request('/api/cdcerserver/v1/cerpersoninfo/editPersonInfo', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}

/**
 * 详情查看
 * @param query
 * @returns {Promise<any>}
 */
export async function getPersonInfo(query) {
    const params = getParamsSuffix(query);
    return request(`/api/cdcerserver/v1/cerpersoninfo/getPersonInfo?${params}`);
}


/**
 * 点击导出所有信息
 * @returns {Promise<any>}
 * @param params
 */
export async function exportPersonInfo(params) {
    return request(`/api/cdcerservice/v1/cerpersoninfo/exportPersonInfo`, {
        method: 'POST',
        requestType: 'form',
        responseType: 'blob',
        data: {
            ...params
        }
    });
}



/**
* 删除
* @param query
* @returns {Promise<any>}
*/
export async function delPersonInfo(query) {
    const params = getParamsSuffix(query);
    return request(`/api/cdcerservice/v1/cerpersoninfo/delPersonInfo?${params}`);
}

